package com.lxm.shownews.bean;

import android.os.Parcel;
import android.os.Parcelable;
import android.text.TextUtils;
import android.util.Log;

import java.util.Comparator;
import java.util.List;

/**
 * Created by lxm on 2016/2/23.
 */
public class News implements Parcelable {
    private String channelId;
    private String channelName;
    private String desc;
    private List<ImageUrl> imageurls;
    private String link;
    private String long_desc;
    private SentimentTag sentiment_tag;
    private String nid;
    private String pubDate;
    private int sentiment_display;
    private String source;
    private String title;
    private Tags tags;
    private List<String> tag;

    public News() {
    }

    protected News(Parcel in) {
        channelId = in.readString();
        channelName = in.readString();
        desc = in.readString();
        link = in.readString();
        long_desc = in.readString();
        nid = in.readString();
        pubDate = in.readString();
        sentiment_display = in.readInt();
        source = in.readString();
        title = in.readString();
        tag = in.createStringArrayList();
    }

    public static final Creator<News> CREATOR = new Creator<News>() {
        @Override
        public News createFromParcel(Parcel in) {
            return new News(in);
        }

        @Override
        public News[] newArray(int size) {
            return new News[size];
        }
    };

    @Override
    public String toString() {
        return "News{" +
                "channelId='" + channelId + '\'' +
                ", channelName='" + channelName + '\'' +
                ", desc='" + desc + '\'' +
                ", imageurls=" + imageurls +
                ", link='" + link + '\'' +
                ", long_desc='" + long_desc + '\'' +
                ", sentiment_tag=" + sentiment_tag +
                ", nid='" + nid + '\'' +
                ", pubDate='" + pubDate + '\'' +
                ", sentiment_display=" + sentiment_display +
                ", source='" + source + '\'' +
                ", title='" + title + '\'' +
                ", tags=" + tags +
                ", tag=" + tag +
                '}' + "\n";
    }

    public String getChannelId() {
        return channelId;
    }

    public void setChannelId(String channelId) {
        this.channelId = channelId;
    }

    public String getChannelName() {
        return channelName;
    }

    public void setChannelName(String channelName) {
        this.channelName = channelName;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public List<ImageUrl> getImageurls() {
        return imageurls;
    }

    public void setImageurls(List<ImageUrl> imageurls) {
        this.imageurls = imageurls;
    }

    public String getLink() {
        return link;
    }

    public void setLink(String link) {
        this.link = link;
    }

    public String getLong_desc() {
        return long_desc;
    }

    public void setLong_desc(String long_desc) {
        this.long_desc = long_desc;
    }

    public String getNid() {
        return nid;
    }

    public void setNid(String nid) {
        this.nid = nid;
    }

    public String getPubDate() {
        return pubDate;
    }

    public void setPubDate(String pubDate) {
        this.pubDate = pubDate;
    }

    public int getSentiment_display() {
        return sentiment_display;
    }

    public void setSentiment_display(int sentiment_display) {
        this.sentiment_display = sentiment_display;
    }

    public String getSource() {
        return source;
    }

    public void setSource(String source) {
        this.source = source;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public List<String> getTag() {
        return tag;
    }

    public void setTag(List<String> tag) {
        this.tag = tag;
    }

    public SentimentTag getSentiment_tag() {
        return sentiment_tag;
    }

    public void setSentiment_tag(SentimentTag sentiment_tag) {
        this.sentiment_tag = sentiment_tag;
    }

    public Tags getTags() {
        return tags;
    }

    public void setTags(Tags tags) {
        this.tags = tags;
    }


    @Override
    public boolean equals(Object o) {
        if (o instanceof News && o != null) {
            News oNews = (News) o;
            if (this.nid.equals(oNews.getNid())) {
                return true;
            }
        }
        return false;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(channelId);
        dest.writeString(channelName);
        dest.writeString(desc);
        dest.writeString(link);
        dest.writeString(long_desc);
        dest.writeString(nid);
        dest.writeString(pubDate);
        dest.writeInt(sentiment_display);
        dest.writeString(source);
        dest.writeString(title);
        dest.writeStringList(tag);
    }

}
